package com.ghj.pojo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author ghj
 * @create 2023-06-16 14:00
 */
//@Component 注解说明这个类被注册到了Spring容器中
@Component
public class User {

    private String name;

    public String getName() {
        return name;
    }

    //等价于 <property name="name" value="张三"/>
    @Value("张三")
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                '}';
    }
}
